package com.ruoyi.labsafety.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.labsafety.mapper.LabSafetyCheckIndexMapper;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.labsafety.domain.LabSafetyCheckIndex;
import com.ruoyi.labsafety.service.ILabSafetyCheckIndexService;

/**
 * 安全检查指标Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-06
 */
@Service
public class LabSafetyCheckIndexServiceImpl implements ILabSafetyCheckIndexService {
	@Autowired
	private LabSafetyCheckIndexMapper labSafetyCheckIndexMapper;

	/**
	 * 查询安全检查指标
	 * 
	 * @param id
	 *            安全检查指标ID
	 * @return 安全检查指标
	 */
	@Override
	public LabSafetyCheckIndex selectLabSafetyCheckIndexById(Long id) {
		return labSafetyCheckIndexMapper.selectLabSafetyCheckIndexById(id);
	}

	/**
	 * 查询安全检查指标列表
	 * 
	 * @param labSafetyCheckIndex
	 *            安全检查指标
	 * @return 安全检查指标
	 */
	@Override
	public List<LabSafetyCheckIndex> selectLabSafetyCheckIndexList(LabSafetyCheckIndex labSafetyCheckIndex) {
		return labSafetyCheckIndexMapper.selectLabSafetyCheckIndexList(labSafetyCheckIndex);
	}

	/**
	 * 新增安全检查指标
	 * 
	 * @param labSafetyCheckIndex
	 *            安全检查指标
	 * @return 结果
	 */
	@Override
	public int insertLabSafetyCheckIndex(LabSafetyCheckIndex labSafetyCheckIndex) {
		String userName = SecurityUtils.getUsername();
		labSafetyCheckIndex.setUserName(userName);
		labSafetyCheckIndex.setCreatedAt(new Date());
		return labSafetyCheckIndexMapper.insertLabSafetyCheckIndex(labSafetyCheckIndex);
	}

	/**
	 * 修改安全检查指标
	 * 
	 * @param labSafetyCheckIndex
	 *            安全检查指标
	 * @return 结果
	 */
	@Override
	public int updateLabSafetyCheckIndex(LabSafetyCheckIndex labSafetyCheckIndex) {
		return labSafetyCheckIndexMapper.updateLabSafetyCheckIndex(labSafetyCheckIndex);
	}

	/**
	 * 批量删除安全检查指标
	 * 
	 * @param ids
	 *            需要删除的安全检查指标ID
	 * @return 结果
	 */
	@Override
	public int deleteLabSafetyCheckIndexByIds(Long[] ids) {
		return labSafetyCheckIndexMapper.deleteLabSafetyCheckIndexByIds(ids);
	}

	/**
	 * 删除安全检查指标信息
	 * 
	 * @param id
	 *            安全检查指标ID
	 * @return 结果
	 */
	@Override
	public int deleteLabSafetyCheckIndexById(Long id) {
		return labSafetyCheckIndexMapper.deleteLabSafetyCheckIndexById(id);
	}

	@Override
	public List<LabSafetyCheckIndex> selectLabSafetyCheckIndexByIds(Long[] indexIds) {

		return labSafetyCheckIndexMapper.selectLabSafetyCheckIndexByIds(indexIds);
	}
}
